package com.sun.controller;

import com.sun.dao.vo.Result;
import com.sun.service.SysUserService;
import com.sun.service.impl.LoginServiceImpl;
import com.sun.utils.JWTUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("users")
public class UserController {

    @Autowired
    private SysUserService sysUserService;

    /*@GetMapping("currentUser")
    public Result currentUser(@RequestHeader("Authorization") String token){

        return sysUserService.findUserByToken(token);
    }*/

    ///users/currentUser
    ///users/currentUser
    @GetMapping("currentUser")
    public Result currentUser(@RequestHeader("Authorization") String token){
        token = LoginServiceImpl.token;
        return sysUserService.findUserByToken(token);
    }
}
